package com.live.video.web.service.impl;

import com.live.video.authority.vo.CommonResponseVO;
import com.live.video.web.entity.Stage;
import com.live.video.web.mapper.KnowledgeContentMapper;
import com.live.video.web.mapper.StageMapper;
import com.live.video.web.service.StatgeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author CHENCHEN
 * @company 北京学佳澳教育科技
 * @create 2022-07-26 12:52
 */
@Slf4j
@Service
public class StatgeServiceImpl implements StatgeService {

    @Autowired
    private StageMapper stageMapper;

    @Autowired
    private KnowledgeContentMapper knowledgeContentMapper;

    @Override
    public CommonResponseVO findStageList(Long specialtyId) {
        log.info("specialtyId value is [{}]", specialtyId);
        List<Stage> list = stageMapper.selectStageList(specialtyId);
        for (Stage stage : list){
            stage.setList(knowledgeContentMapper.selectKnowledgeContentListByStageId(stage.getId()));
        }
        log.info("find stageList content is [{}]", list);
        return CommonResponseVO.SUCCESS(list);
    }
}
